<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: MCWDT        (Multi-Counter Watchdog)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__mcwdt.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">MCWDT (Multi-Counter Watchdog)</div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>A MCWDT has two 16-bit counters and one 32-bit counter. </p>
<p>The functions and other declarations used in this driver are in cy_mcwdt.h. You can include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<p>You can use this driver to create a free-running timer or generate periodic interrupts. The driver also includes support for the watchdog function to recover from CPU or firmware failures.</p>
<p>There are two primary use cases for MCWDT: generating periodic CPU interrupts; and implementing a free-running timer. Both have many applications in embedded systems:</p><ul>
<li>Measuring time between events</li>
<li>Generating periodic events</li>
<li>Synchronizing actions</li>
<li>Real-time clocking</li>
<li>Polling</li>
</ul>
<p>An additional use case is to implement a watchdog used for recovering from a CPU or firmware failure.</p>
<h1><a class="anchor" id="group_mcwdt_configuration"></a>
Configuration Considerations</h1>
<p>Each MCWDT may be configured for a particular product. One MCWDT block can be associated with only one CPU during runtime. A single MCWDT is not intended to be used by multiple CPUs simultaneously. Each block contains three sub-counters, each of which can be configured for various system utility functions - free running counter, periodic interrupts, watchdog reset, or three interrupts followed by a watchdog reset. All counters are clocked by either LFCLK (nominal 32 kHz) or by a cascaded counter. A simplified diagram of the MCWDT hardware is shown below: </p><div class="image">
<img src="mcwdt.png" alt="mcwdt.png"/>
</div>
<p> The frequency of the periodic interrupts can be configured using the Match value with combining Clear on match option, which can be set individually for each counter using <a class="el" href="group__group__mcwdt__functions.html#ga77bb788adb7fac2042772b00a61f95cb" title="Sets the Clear on match option for the specified counter. ">Cy_MCWDT_SetClearOnMatch()</a>. When the Clear on match option is not set, the periodic interrupts of the C0 and C1 16-bit sub-counters occur after 65535 counts and the match value defines the shift between interrupts (see the figure below). The enabled Clear on match option resets the counter when the interrupt occurs. </p><div class="image">
<img src="mcwdt_counters.png" alt="mcwdt_counters.png"/>
</div>
<p> 32-bit sub-counter C2 does not have Clear on match option. The interrupt of counter C2 occurs when the counts equal 2<sup>Toggle bit</sup> value. </p><div class="image">
<img src="mcwdt_subcounters.png" alt="mcwdt_subcounters.png"/>
</div>
<p> To set up an MCWDT, provide the configuration parameters in the <a class="el" href="structcy__stc__mcwdt__config__t.html" title="The MCWDT component configuration structure. ">cy_stc_mcwdt_config_t</a> structure. Then call <a class="el" href="group__group__mcwdt__functions.html#gab8bd6fb7ec48ef294287c01e179c41df" title="Initializes the MCWDT block. ">Cy_MCWDT_Init()</a> to initialize the driver. Call <a class="el" href="group__group__mcwdt__functions.html#ga90f8d4636fc67fc8abe3bfd87ab521ac" title="Enables all specified counters. ">Cy_MCWDT_Enable()</a> to enable all specified counters.</p>
<p>You can also set the mode of operation for any counter. If you choose interrupt mode, use <a class="el" href="group__group__mcwdt__functions.html#gaeaa26b488af90a877760cffc61ad08e3" title="Writes MCWDT interrupt mask register. ">Cy_MCWDT_SetInterruptMask()</a> with the parameter for the masks described in Macro Section. All counter interrupts are OR'd together to from a single combined MCWDT interrupt. Additionally, enable the Global interrupts and initialize the referenced interrupt by setting the priority and the interrupt vector using <a class="el" href="group__group__sysint__functions.html#gab2ff6820a898e9af3f780000054eea5d">Cy_SysInt_Init()</a> of the sysint driver.</p>
<p>The values of the MCWDT counters can be monitored using <a class="el" href="group__group__mcwdt__functions.html#ga82cd9aad79c9faf18b7a5ada22c3f7d3" title="Reports the current counter value of the specified counter. ">Cy_MCWDT_GetCount()</a>.</p>
<p>CAT1C and TVIIBE devices support MCWDT_B type of counters, which are slightly different from MCWDT, which is explained above</p>
<p>A simplified diagram of the MCWDT_B hardware is shown below: </p><div class="image">
<img src="mcwdt_b.png" alt="mcwdt_b.png"/>
</div>
<dl class="section note"><dt>Note</dt><dd>Please refer to TRM for more information on CAT1C and TVIIBE supported MCWDT_B counters.</dd>
<dd>
In addition to the MCWDTs, each device has a separate watchdog timer (WDT) that can also be used to generate a watchdog reset or periodic interrupts. For more information on the WDT, see the appropriate section of the PDL.</dd></dl>
<h1><a class="anchor" id="group_mcwdt_more_information"></a>
More Information</h1>
<p>For more information on the MCWDT peripheral, refer to the technical reference manual (TRM).</p>
<h1><a class="anchor" id="group_mcwdt_changelog"></a>
Changelog</h1>
<table class="doxtable">
<tr>
<th>Version</th><th>Changes</th><th>Reason for Change </th></tr>
<tr>
<td>1.90 </td><td>Documentation update  </td></tr>
<tr>
<td>1.80 </td><td>Added support for TRAVEO&trade; II Body Entry devices.<br />
 Pre-processor check for MXS40SRSS version now groups ver. 2 with ver. 3. Previously ver. 2 was grouped with ver. 1. </td><td>Code enhancement and support for new devices.  </td></tr>
<tr>
<td>1.70 </td><td>Added MCWDT_B type support required for CAT1C devices.<br />
Newly added APIs: <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga366d471122c4324a20bfb49b88b611f5" title="Sets the lower limit action of the specified counter. ">Cy_MCWDT_SetLowerAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gad043073e808d60849d106283d3955377" title="Sets the upper limit action of the specified counter. ">Cy_MCWDT_SetUpperAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga7d4361ed633c0302a39d077cfdc8d7b4" title="Sets the warn limit action of the specified counter. ">Cy_MCWDT_SetWarnAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga3cca2590256f5f0b6509bd45dce71941" title="Sets the counter 2 action of the specified counter. ">Cy_MCWDT_SetSubCounter2Action()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga19e5cc99601e7590a206211c24381db8" title="Reports the lower limit action type of the specified counter. ">Cy_MCWDT_GetLowerAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga71678baab1ad3f68a2a11bfb0a4a6f40" title="Reports the upper limit action type of the specified counter. ">Cy_MCWDT_GetUpperAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga6cd37cd4d24b8668a19f17f49b7c9631" title="Reports the warn limit action type of the specified counter. ">Cy_MCWDT_GetWarnAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga6ea81605e48bf608162140af9ea258d7" title="Reports the counter 2 action type of the specified counter. ">Cy_MCWDT_GetSubCounter2Action()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga04d9c4538fc41df99f95c86545fa9f60" title="Sets the Auto service option for the specified counter. ">Cy_MCWDT_SetAutoService()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga5fe194dcc78fc8bd3c06f97464fef632" title="Reports the Auto service setting for the specified counter. ">Cy_MCWDT_GetAutoService()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gabba3ba56c68c48950212dc6d20956bd2" title="Sets the Sleep deep pause option for the specified counter. ">Cy_MCWDT_SetSleepDeepPause()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga034fcbb8cca5d6de3a451f622e5717d0" title="Reports the Sleep deep pause setting for the specified counter. ">Cy_MCWDT_GetSleepDeepPause()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga36e5f597079178fa716e8610507d888c" title="Sets the Debug run option for the specified counter. ">Cy_MCWDT_SetDebugRun()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gaf30fc627ed06db95b32b6c7f7d74ac7e" title="Reports the Debug run setting for the specified counter. ">Cy_MCWDT_GetDebugRun()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gaae6c32b6cccf0dcbee4bd04c94898864" title="Sets the lower limit value for the specified counter (0 or 1). ">Cy_MCWDT_SetLowerLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga189e0fc8639485938c9bec90ab7d2ea6" title="Sets the upper limit value for the specified counter (0 or 1). ">Cy_MCWDT_SetUpperLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga7010d2642420171c8c53f9165cbb3be0" title="Sets the warn limit value for the specified counter (0 or 1). ">Cy_MCWDT_SetWarnLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga3a74c8b0934307d550ed201bb1b9fed8" title="Reports the Lower Limit value of the specified counter. ">Cy_MCWDT_GetLowerLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gad05cf6c4a4b7c1bef71b9f1a84f53b3f" title="Reports the upper limit comparison value for the specified counter (0 or 1). ">Cy_MCWDT_GetUpperLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga4e08c92f6ce86bd1089c4c5eecf7635b" title="Reports the warn limit comparison value for the specified counter (0 or 1). ">Cy_MCWDT_GetWarnLimit()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga070d6f92c33d9be8774711e690dffc0b" title="wait completion of counter reset. ">Cy_MCWDT_WaitForCounterReset()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga1b1ea9a634f2e76b856d38a0c649a0c4" title="Select deep sleep of which core for pausing this counter. ">Cy_MCWDT_CpuSelectForDpSlpPauseAction()</a>, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga9d105e8b26101615b50496b3c584e364" title="Reports if match is enabled with combined cascade counters or not. ">Cy_MCWDT_GetCascadeMatchCombined()</a>. </td><td>Support for new devices.  </td></tr>
<tr>
<td>1.60 </td><td>CAT1B, CAT1C devices support.<br />
Newly added APIs: <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga3a74c8b0934307d550ed201bb1b9fed8" title="Reports the Lower Limit value of the specified counter. ">Cy_MCWDT_GetLowerLimit()</a> to get the lower limit value of the specified counter, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gaae6c32b6cccf0dcbee4bd04c94898864" title="Sets the lower limit value for the specified counter (0 or 1). ">Cy_MCWDT_SetLowerLimit()</a> to set the the lower limit value of the specified counter, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga325b3bb0d2404854c78908c5118c2ce4" title="Reports the lower limit mode of the specified counter. ">Cy_MCWDT_GetLowerLimitMode()</a> to get the lower limit mode of the specified counter, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gafbe6c4d34f78ba955484a1524ef585ea" title="Sets the lower limit mode option for the specified counter. ">Cy_MCWDT_SetLowerLimitMode()</a> to set the lower limit mode of the specified counter, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga7049df180477872251c6bf5f979df30c" title="Gets lower limit registers cascaded value. ">Cy_MCWDT_GetLowerLimitCascaded()</a> to get the lower limit registers cascaded value, <br />
 <a class="el" href="group__group__mcwdt__functions.html#gaa93172fa1b72d328964f90325421f2f5" title="Enables the Rollover mode for carryout. ">Cy_MCWDT_SetCascadeCarryOutRollOver()</a> to enable the Rollover mode for carryout, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga556f4e8c658c4f4e669d186938db36f1" title="Checks if Rollover mode enabled for carryout or not. ">Cy_MCWDT_GetCascadeCarryOutRollOver()</a> to check if Rollover mode enabled for carryout or not, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga1bd47a8cc5217f1077a92f57bac19100" title="Sets the match to combined cascade counters. ">Cy_MCWDT_SetCascadeMatchCombined()</a> to set the match to combined cascade counters, <br />
 <a class="el" href="group__group__mcwdt__functions.html#ga9d105e8b26101615b50496b3c584e364" title="Reports if match is enabled with combined cascade counters or not. ">Cy_MCWDT_GetCascadeMatchCombined()</a> to report if match is enabled with combined cascade counters or not. </td><td>Support for new devices.  </td></tr>
<tr>
<td>1.50.1 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td>1.50 </td><td>Added support for new family of devices. </td><td>New device support.  </td></tr>
<tr>
<td>1.40 </td><td>Fixed/documented MISRA 2012 violations. </td><td>MISRA 2012 compliance.  </td></tr>
<tr>
<td>1.30.1 </td><td>Minor documentation updates. </td><td>Documentation enhancement.  </td></tr>
<tr>
<td>1.30 </td><td>In version 1.20 the <a class="el" href="group__group__mcwdt__functions.html#ga2c7f8cc4f0897618bb6c4b3389357086" title="Reports the current value of combined C1-C0 cascaded counters. ">Cy_MCWDT_GetCountCascaded()</a> function returned the wrong value when counter#1 overflowed. This bug is corrected in version 1.30.  </td><td>Defect fixes.   </td></tr>
<tr>
<td rowspan="2">1.20 </td><td>Flattened the organization of the driver source code into the single source directory and the single include directory.  </td><td>Driver library directory-structure simplification.  </td></tr>
<tr>
<td>Added register access layer. Use register access macros instead of direct register access using dereferenced pointers. </td><td>Makes register access device-independent, so that the PDL does not need to be recompiled for each supported part number.  </td></tr>
<tr>
<td>1.10.1 </td><td>Updated description of the <a class="el" href="structcy__stc__mcwdt__config__t.html">cy_stc_mcwdt_config_t</a> structure type </td><td>Documentation update and clarification  </td></tr>
<tr>
<td>1.10 </td><td>Added input parameter validation to the API functions.<br />
 Added API function GetCountCascaded() </td><td></td></tr>
<tr>
<td>1.0 </td><td>Initial version </td><td></td></tr>
</table>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__mcwdt__macros"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mcwdt__macros.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mcwdt__functions"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mcwdt__functions.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mcwdt__data__structures"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mcwdt__data__structures.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__mcwdt__enums"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__mcwdt__enums.html">Enumerated Types</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
